package com.shelpe.services.sinbad.repository.jpa;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import com.shelpe.services.sinbad.entity.jpa.ProductImages;
import com.shelpe.services.sinbad.entity.jpa.ProductImages.ProductImagesPK;

public interface ProductImageRepository extends CrudRepository<ProductImages, ProductImagesPK> {

	List<ProductImages> findByProductID(long productID);
	
	@Modifying@Transactional  
	@Query("update product_imags p set p.url = ?1  where p.productID=?2 and p.imageId=?3")
	public int updateImgUrl(String url, long productId,long imgId);
}
